package com.xindong.paking.utils;

public class Result {
    private int status;
    private String message;
    private Object data;

    public Result() {
    }

    public static Result success(String message, Object data) {
        return new Result(200, message, data);
    }

    public static Result success(String message) {
        return new Result(200, message);
    }

    public static Result error(String message) {
        return new Result(400, message);
    }

    public Result(int status, String message) {
        this.status = status;
        this.message = message;
    }
    //通过枚举对象信息对Result对象进行初始化
    public Result(ResultStatus resultStatus){
        this.status = resultStatus.getStatus();
        this.message = resultStatus.getMessage();
    }
    //通过枚举对象信息对Result对象进行初始化
    public Result(ResultStatus resultStatus, Object data){
        this.status = resultStatus.getStatus();
        this.message = resultStatus.getMessage();
        this.data = data;
    }
    public Result(int status, String message, Object data) {
        this.status = status;
        this.message = message;
        this.data = data;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
